﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Microsoft.Office.OneNote
{
    public abstract class OneNoteSectionBase : OneNoteFolder
    {
        private OneNoteObjectCollection<OneNotePage> _pages;
        private OneNoteObjectCollection<OneNoteSectionBase> _sections;

        internal OneNoteSectionBase(OneNoteObjectId id)
            : base(id)
        {
        }

        public abstract OneNoteColor Color
        {
            get;
            set;
        }

        public OneNoteObjectCollection<OneNoteSectionBase> Sections
        {
            get
            {
                if (_sections == null)
                {
                    EnsureStorageInitialized();
                    _sections = new OneNoteObjectCollection<OneNoteSectionBase>(Storage);
                }

                return _sections;
            }
        }

        public OneNoteObjectCollection<OneNotePage> Pages
        {
            get
            {
                if (_pages == null)
                {
                    EnsureStorageInitialized();
                    _pages = new OneNoteObjectCollection<OneNotePage>(Storage);
                }

                return _pages;
            }
        }
    }
}
